package com.project.controller;

import com.project.bean.RoomBean;
import com.project.service.IRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("room")
public class RoomController {
    @Autowired
    private IRoomService service;

    @RequestMapping("findAll")
    public List<RoomBean> findAll(){

        return service.findAll();
    }
    @RequestMapping("add")
    public String add(RoomBean room){
        service.add(room);
        return "ok";
    }
    @RequestMapping("del")
    public String delRoom(int id){
        service.del(id);
        return "ok";
    }
    @RequestMapping("findById")
    public RoomBean finById(int id){
        return service.findById(id);
    }
    @RequestMapping("findByItem")
    public List<RoomBean> findByItem(String address,String statues,String canRoom,String type){
        return service.findByItem(address,statues,canRoom,type);
    }
}
